Skip to content

feat: filesystem grep, read, write, edit file and workspace support#7402

Draft
Soulter wants to merge 6 commits intomasterfrom
feat/fs-grep-read-edit
Draft

feat: filesystem grep, read, write, edit file and workspace support#7402
Soulter wants to merge 6 commits intomasterfrom
feat/fs-grep-read-edit

Conversation

@Soulter
Copy link
Copy Markdown
Member

@Soulter Soulter commented Apr 6, 2026

Modifications / 改动点

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果


Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Add filesystem tools for searching, reading, and editing files across local, sandbox, and Shipyard runtimes, with user-aware access restrictions and pagination support.

New Features:

  • Introduce a read-file tool that supports offsets and limits for partial file reads.
  • Introduce a file-edit tool that performs string replacements in files with optional replace-all behavior.
  • Introduce a grep-style search tool for querying file contents using ripgrep or grep with context and result limiting.
  • Add workspace path handling to scope filesystem operations per user/session.

Enhancements:

  • Extend filesystem abstraction and booters (local, shipyard, shipyard_neo, boxlite) to support search and edit operations in addition to basic CRUD.
  • Wire the new filesystem tools into local and sandbox toolsets so agents can use them alongside existing shell and Python tools.
  • Relax local booter path restrictions while enforcing read-only directory restrictions at the tool level for non-admin users.

Build:

  • Add python-ripgrep as a project dependency for content searching.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new filesystem tools—ReadFileTool, FileEditTool, and GrepTool—and updates the local and sandbox booters to support these operations. It also implements a security layer to restrict file access for non-admin users in local environments. The review feedback highlights potential memory issues when reading or editing large files in their entirety and suggests applying the documented default limit for file reads to prevent excessive memory consumption.

limit: int | None = None,
) -> dict[str, Any]:
_ = encoding
content = await self._sandbox.filesystem.read_file(path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This implementation reads the full content of the file from the sandbox into the bot's memory before slicing. This is inefficient for large files. If the Shipyard Neo SDK supports range-based reads, they should be used here to fetch only the requested slice.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @RC-CHN

@Soulter Soulter changed the title feat: filesystem grep, read, edit file feat: filesystem grep, read, write, edit file and workspace support Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant